import { createRequestPromise } from '../utils/request';
import moment from 'moment';

export function getUserList (params) {
  return createRequestPromise('USER_LIST_URL', params).then((res) => {
    return {
      ...res,
      rows: res.rows.map((row, idx) => {
        return {
          ...row,
          index: (params.page - 1) * params.size + idx + 1,
          enableState: row.enableState ? '不可用' : '可用',
          formOfEmployment: row.formOfEmployment ? '不在职' : '在职',
          timeOfEntry: moment(row.timeOfEntry).format('YYYY-MM-DD'),
        };
      }),
    };
  });
}
